from time import sleep

from selenium import webdriver
from selenium.webdriver.common.by import By


wd = webdriver.Chrome()
wd.maximize_window()
wd.get("https://cn.bing.com/")
wd.implicitly_wait(5)
wd.find_element(By.ID,"sb_form_q").send_keys("豆瓣电影")
wd.find_element(By.ID, 'search_icon').click()
wd.find_element(By.LINK_TEXT,"豆瓣电影").click()
win = wd.window_handles
wd.switch_to.window(win[-1])
wd.find_element(By.LINK_TEXT,"排行榜").click()
wd.find_element(By.LINK_TEXT,"喜剧").click()
wd.find_element(By.LINK_TEXT,"美丽人生").click()
win = wd.window_handles
wd.switch_to.window(win[-1])
wd.find_element(By.LINK_TEXT,"写短评").click()
wd.switch_to.frame("https://movie.douban.com")
wd.find_element(By.CSS_SELECTOR,"body > div.account-body.login-wrap.login-start > div.account-tabcon-start > div.account-form > div:nth-child(3) > div > input").send_keys(1111)
#页面前进后退
# wd.forward()
# wd.back()
#刷新
wd.refresh()
#查看标题
print(wd.title)
#查看url
wd.current_url()